<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入vue2的js文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.9/vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" ref="inpRef">
        <button @click="focus">点击聚焦</button>
    </div>
    <script>
        new Vue({
            el: '#app',
            methods: {
                focus() {
                    this.$refs.inpRef.focus()
                }
            }
        })
    </script>
</body>

</html>